@if ( $level == 'po' )
	@foreach ( $results as $key => $result )
		<div class="panel-heading">
			<h3>Latest {{ $po_statuses[$key] }} Purchase Orders</h3>
		</div>
		<div class="panel-overview panel panel-body fadeIn">
			<div class="panel-body">
		@if ( $result->count() ) 
			<table class="table-overview table table-hover">
				<thead>
					<tr>
						<td class="text-left">Purchase Order ID</td>  
						<td class="text-left">PO Number</td>  
						<td class="text-left">Vendor</td>
						<td class="text-left">Company</td>
						<td class="text-left">Prepared By</td>
						<td class="text-left">Total Items</td>
						<td class="text-left">Date Prepared</td>
						<td class="text-left">Shipping Method</td>
						<td class="text-left">Comments</td>
						<td class="text-left">Action</td> 
					</tr>
				</thead>
				<tbody>
					@foreach($result as $value)
					<tr>
						<td>{{ $value->id }}</td>
						<td>{{ strtoupper($value->vendor->code) }}-{{ str_pad($value->id, 3, '0', STR_PAD_LEFT) }}-{{ date_format($value->created_at, 'Ymd') }}</td>
						<td>{{ $value->vendor->name }}</td>
						<td>{{ $value->company->name }}</td>
						<td>{{ $value->createdBy->firstname }} {{ $value->createdBy->lastname }}</td>
						<td>{{ $value->purchaseOrderProducts->count() }}</td>
						<td>{{ date_format($value->created_at, 'Y-m-d') }}</td>
						<td>{{ $value->shipping_method }}</td>
						<td>{{ $value->comment }}</td>
						<td><a class="btn-success btn" href="{{ URL::to('po') }}?filter_id={{ $value->id }}&view_details=1">View</a></td>
					</tr>
					@endforeach  
				</tbody>
			</table>
		@else
		No Results Found.
		@endif
			</div>
		</div>
	@endforeach
@else
	<div class="panel-heading">
			<h3>Latest PO Items To Receive</h3>
		</div>
		<div class="panel-overview panel panel-body fadeIn">
			<div class="panel-body">
		@if ( $results->count() ) 
			<table class="table-overview table table-hover">
				<thead>
					<tr>
						<td class="text-left">Order Product ID</td>
						<td class="text-left">Sales Order ID</td>
						<td class="text-left">Product Name</td>
						<td class="text-left">Ordered QTY</td>
						<td class="text-left">Purchase Order ID</td>
						<td class="text-left">PO Number</td>  
						<td class="text-left">Vendor</td>
						<td class="text-left">Company</td>
						<td class="text-left">Prepared By</td>
						<td class="text-left">Date Prepared</td>
						<td class="text-left">Approved By</td>
						<td class="text-left">Date Approved</td>
						<td class="text-left">Delivery Date</td>
						<td class="text-left">Action</td> 
					</tr>
				</thead>
				<tbody>
					@foreach($results as $value)
					<tr>
						<td>{{ $value->ORDER_PRODUCT_id }}</td>
						<td>{{ $value->orderProduct->ORDER_id }}</td>
						<td>{{ $value->orderProduct->name }}</td>
						<td>{{ $value->orderProduct->quantity }}</td>
						<td>{{ $value->PURCHASE_ORDER_id }}</td>
						<td>{{ strtoupper($value->PurchaseOrder->vendor->code) }}-{{ str_pad($value->PURCHASE_ORDER_id, 3, '0', STR_PAD_LEFT) }}-{{ date_format($value->PurchaseOrder->created_at, 'Ymd') }}</td>
						<td>{{ $value->PurchaseOrder->vendor->name }}</td>
						<td>{{ $value->PurchaseOrder->company->name }}</td>
						<td>{{ $value->PurchaseOrder->createdBy->firstname }} {{ $value->PurchaseOrder->createdBy->lastname }}</td>
						<td>{{ date_format($value->PurchaseOrder->created_at, 'Y-m-d') }}</td>
						<td>{{ $value->PurchaseOrder->approvedBy->firstname }} {{ $value->PurchaseOrder->approvedBy->lastname }}</td>
						<td>{{ Formatter::toDateFormat($value->PurchaseOrder->approved_at) }}</td>
						<td>{{ Formatter::toDateFormat($value->PurchaseOrder->approved_at, 'm-d-Y', 7 ) }}</td>
						<td><a class="btn-success btn" href="{{ URL::to('po') }}?filter_id={{ $value->PURCHASE_ORDER_id }}&view_details=1">View</a></td>
					</tr>
					@endforeach  
				</tbody>
			</table>
		@else
		No Results Found.
		@endif
			</div>
		</div>
@endif